feat(sanitization): support bigint
params by not wrapping them in quotes
#159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi 👋🏻, Alberto from @prisma here.
This PR fixes a surprising behavior we at @prisma found while adding new tests for an internal PR related to our new Driver Adapters feature.
We noticed that the JavaScript PlanetScale driver currently doesn't support
bigint
query parameters: these parameters are treated as strings by the client-side sanitization routine, causing SQL syntax errors at runtime.For instance,
SELECT * FROM user LIMIT ?
with parameters[1n]
is validated asSELECT * FROM user LIMIT '1'
, which of course results in a SQL error.Here is the relevant output of
pnpm test
after adding this new test:If we apply the same sanitization logic currently applied on
number
query parameters, the tests pass.I'm of course available for feedback concerning this PR :)